package com.example;

import com.example.service.OrderService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        try (var ctx = new ClassPathXmlApplicationContext("applicationContext.xml")) {
            OrderService service = ctx.getBean("orderService", OrderService.class);

            System.out.println("\n======= 第一次 add ========");
            try { service.add("iPhone", 2); } catch (Exception ignore) {}

            System.out.println("\n======= 第二次 delete ========");
            try { service.delete("iPhone"); } catch (Exception ignore) {}

            System.out.println("\n======= 第三次 find =========");
            int num = service.find("iPhone");
            System.out.println("main 拿到返回值 = " + num);
        }
    }
}